<template>
    <!-- 今日早报 -->
    <div class="madp-morning-paper" @click="jump" v-if="title">
        <img src="@/assets/img/financialShop/jinrizaobao.png" alt="" />
        <div class="info cursor-pointer">
            <span class="dot"></span>
            <div class="main text-one-ellipsis">{{ title }}</div>
            <i class="el-icon-arrow-right"></i>
        </div>
    </div>
</template>
<script>
    import mxInitWxConfig from '@/mixin/mxInitWxConfig.js';
    import paperApi from '@/api/paper';
    export default {
        mixins: [mxInitWxConfig],
        components: {},
        props: {
            sort: {
                type: Number,
                default: 0
            }
        },
        data() {
            return {
                title: ''
            };
        },
        created() {
            this.initText();
        },
        mounted() {},
        methods: {
            initText() {
                paperApi.getHomeTitle().then((res) => {
                    if (res.data.code != 0) return;
                    this.title = res.data.data;
                });
            },
            jump() {
                this.$sensorsSend('MktClick', {
                    recommend_id: this.$store.state.vuex_wxUserId,
                    $title: '首页',
                    mkt_type: '',
                    mkt_name: '早报',
                    mkt_location: this.sort,
                    mkt_content_name: '早报',
                    mkt_content_type: '早报'
                });
                this.$router.push({
                    path: '/financialShop/paper/index',
                    query: {
                        wxUserId: this.wxUserId
                    }
                });
            }
        }
    };
</script>
<style scoped lang="scss">
    .madp-morning-paper {
        display: flex;
        margin: 8px 0;
        width: 100%;
        height: 40px;
        background: linear-gradient(270deg, #ffffff 0%, #fff2ee 100%);
        box-shadow: 0px 3px 6px 0px rgba(181, 181, 181, 0.16);
        border-radius: 6px;
        img {
            width: 40px;
            margin-left: 9px;
        }
        .info {
            flex: 1;
            display: flex;
            align-items: center;
            padding-right: 12px;
            margin-left: 12px;
            font-size: 14px;
            overflow: hidden;
            .dot {
                border: 2px solid #ed5555;
                border-radius: 50%;
                padding: 2px;
            }
            .main {
                margin-left: 4px;
                font-size: 14px;
                font-family: PingFangSC-Regular, PingFang SC;
                font-weight: 400;
                color: #2c2c2c;
                display: inline-block;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
    }
</style>
